package com.andy.wang.controller;
import com.andy.wang.pojo.User;
import com.andy.wang.service.UserService;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.io.UnsupportedEncodingException;

@RestController
@CrossOrigin
@RequestMapping("/MyMsg")
public class MyMsgController {
    @Autowired
    private UserService userService;


    @RequestMapping( value="/update/{imgType}/{Phone}",method = RequestMethod.POST,produces = "application/json;charset=utf-8")
    public int update(HttpServletRequest request,@RequestBody User user,@PathVariable(value = "imgType")String imgType,@PathVariable(value = "Phone")String Phone) throws UnsupportedEncodingException {
        return userService.updateUser(request,user,imgType,Phone);
    }
    //   注销个人账号
    @PutMapping("/zhu/{id}")
    public int delete(@PathVariable Integer id){
        return userService.deleteUser(id);
    }
}
